In [1]:
    
import imp
packages = ['numpy',
            'scipy',
            'matplotlib',
            'pandas',
            'sklearn']
for pac in packages:
    try:
        imp.find_module(pac)
        print("{}: Ok!".format(pac))
    except ImportError as e:
        print("{}: Error -- {}".format(pac, e))
    
    
In [ ]: